<?php
class routermanager extends CI_Model {

    public function __construct()
    {
        $this->load->database();
    }
	public function save_mac($mac = '',$phone,$t,$m)
	{
		if($mac==''){
			return ;
		}
		$md=md5($mac.$phone.$t.'hh');
		if($md!=$m){
			return array('status'=>0);
		}
		$query = $this->db->query('SELECT * FROM router where mac_address="'.$mac.'" ');
		$row = $query->row_array();
		if($row!=null){
			return array('status'=>2);
		}
		$sql = 'insert into router (mac_address,bind_phone) values ("'.$mac.'","'.$phone.'")';
		$this->db->query($sql);
		return array('status'=>1);
	}
}